open Random;;
open Card;;
open Common;;
let ref_deck = [|
As,    Club;
King,  Club;
Queen, Club;
Joker, Club;
Ten,   Club;
Nine,  Club;
Eight, Club;
Seven, Club;
Six,   Club;
Five,  Club;
Four,  Club;
Three, Club;
Two,   Club;
As,    Heart;
King , Heart;
Queen, Heart;
Joker, Heart;
Ten,   Heart;
Nine,  Heart;
Eight, Heart;
Seven, Heart;
Six,   Heart;
Five,  Heart;
Four,  Heart;
Three, Heart;
Two,   Heart;
As,    Diamond;
King , Diamond;
Queen, Diamond;
Joker, Diamond;
Ten,   Diamond;
Nine,  Diamond;
Eight, Diamond;
Seven, Diamond;
Six,   Diamond;
Five,  Diamond;
Four,  Diamond;
Three, Diamond;
Two,   Diamond;
As,    Spade;
King , Spade;
Queen, Spade;
Joker, Spade;
Ten,   Spade;
Nine,  Spade;
Eight, Spade;
Seven, Spade;
Six,   Spade;
Five,  Spade;
Four,  Spade;
Three, Spade;
Two,   Spade|];;

type deck = card list;;


let init_deck ()= Array.to_list (unsort_array ref_deck);;

let get_card deck = 
  match !deck with
  | []   -> failwith "deck: get_card Empty deck"
  | h::t -> deck := t; h;;
  
let burn_card deck = 
  match !deck with
  | []   -> failwith "deck: burn_card Empty deck"
  | h::t -> deck := t;;
  


